const express = require('express')
const router = express.Router()
const controller = require('../controller/news')
const auth = require('../middleware/auth')

router.post('/api/news', controller.add)
router.delete('/api/news/:id', controller.remove)
router.put('/api/news', controller.update)
router.get('/api/news', controller.list)
router.get('/api/news/:id', controller.detail)
router.get('/news', controller.showIndex)
router.get('/news/add', controller.showAdd)
router.get('/news/edit/:id', controller.showEdit)

router.post('/admin/news', auth, controller.add)
router.delete('/admin/news/:id', auth, controller.remove)
router.put('/admin/news', auth, controller.update)
router.get('/admin/news', auth, controller.list)
router.get('/admin/news/:id', auth, controller.detail)

module.exports = router